package org.kl.bf.entity.basic;

import java.sql.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.kl.bf.entity.AuditableEntity;

import com.fasterxml.jackson.annotation.JsonFormat;

@Entity
@Table(name = "basic_sessions")
public class Sessions extends AuditableEntity {
	private static final long serialVersionUID = 7540215485872365182L;
	private String sessionId;
	private User user;// 登录者
	private String host;// 用户主机IP
	private String userAgent;// 用户浏览器信息
	private String systemHost;// 当前系统主机地址
	private Date startTime;// 登录时间
	private Date stopTime;// 登出时间
	private Date lastAccessTime;// 上次访问时间
	private String onlineStatus;// 在线状态
	private String sessionSerialize;

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	@ManyToOne
	@JoinColumn(name = "user_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public String getUserAgent() {
		return userAgent;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public String getSystemHost() {
		return systemHost;
	}

	public void setSystemHost(String systemHost) {
		this.systemHost = systemHost;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getStopTime() {
		return stopTime;
	}

	public void setStopTime(Date stopTime) {
		this.stopTime = stopTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getLastAccessTime() {
		return lastAccessTime;
	}

	public void setLastAccessTime(Date lastAccessTime) {
		this.lastAccessTime = lastAccessTime;
	}

	public String getOnlineStatus() {
		return onlineStatus;
	}

	public void setOnlineStatus(String onlineStatus) {
		this.onlineStatus = onlineStatus;
	}

	public String getSessionSerialize() {
		return sessionSerialize;
	}

	public void setSessionSerialize(String sessionSerialize) {
		this.sessionSerialize = sessionSerialize;
	}

}